/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package engine.entities.inventory.item;

import engine.entities.inventory.PartyInventory;
import engine.entities.inventory.item.armor.Greaves;
import engine.entities.inventory.item.armor.Shield;
import engine.entities.inventory.item.clothing.Boots;
import engine.entities.inventory.item.clothing.Cape;
import engine.entities.inventory.item.clothing.Crown;
import engine.entities.inventory.item.clothing.Robe;
import engine.entities.inventory.item.jewelry.Necklace;
import engine.entities.inventory.item.jewelry.Ring;
import engine.entities.inventory.item.weapon.Sword;
import engine.resource.Resources;

/**
 *
 * @author NathanT
 */
public class PartyInventoryTable extends InventoryTable {

    public PartyInventoryTable(PartyInventory inventory) {
        super(inventory);
        this.setInventoryTableListener(new PartyTableListener());
    }

    @Override
    protected void initRenderers() {
        for (int i = 0; i < items.length; i++) {
            for (int j = 0; j < items[0].length; j++) {
                if (i == 0 && j == 0) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Crown(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 1) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Boots(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 2) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Sword(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 3) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Shield(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 4) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Robe(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 5) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Greaves(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 6) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Necklace(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 7) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Cape(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 8) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Ring(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else if (i == 0 && j == 9) {
                    items[i][j] = new InventoryItemRenderer(new InventoryItem(new Ring(), 1), Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
                else {
                    items[i][j] = new InventoryItemRenderer(null, Resources.getSprite("EMPTY_SLOT_ICON"), null);
                }
            }
        }
    }
    
    private class PartyTableListener implements InventoryTableListener {
        @Override
        public void itemChanged(int row, int column, InventoryItem newItem) {
            inventory.setItem(row, column, newItem);
        }
    }
    
}
